package com.sj.parksdk.adapter.carmanage;

import android.widget.TextView;

import androidx.annotation.NonNull;

import com.ruffian.library.widget.RLinearLayout;
import com.ruffian.library.widget.helper.RBaseHelper;
import com.sj.parksdk.R;
import com.xuexiang.xui.adapter.recyclerview.BaseRecyclerAdapter;
import com.xuexiang.xui.adapter.recyclerview.RecyclerViewHolder;
import com.xuexiang.xui.utils.ResUtils;

public class AdapterCarNumberGridAdapter extends BaseRecyclerAdapter<String> {
    @Override
    protected int getItemLayoutId(int viewType) {
        return R.layout.parksdk_adapter_carnumber_grid_item;
    }

    @Override
    protected void bindData(@NonNull RecyclerViewHolder holder, int position, String item) {
        TextView tv = holder.findViewById(R.id.tv_nubmer);
        tv.setText(item);
        RLinearLayout rllItem = holder.findViewById(R.id.rll_item);
        rllItem.setSelected(getSelectPosition() == position);
        RBaseHelper helper = rllItem.getHelper();
        if (position == mData.size() - 1) {
            if(getSelectPosition() != position){
                helper.setBorderDash(10, 8);
            }
            helper.setBackgroundColorNormal(ResUtils.getColor(R.color.color_number_end));
            tv.setHint("新");
            return;
        }
        helper.setBorderDash(0, 0);
        helper.setBackgroundColorNormal(ResUtils.getColor(R.color.color_white));
        tv.setHint("");
    }
}
